Skip to content

London | 26-ITP-SEPT | Abakar Souleyman | Sprint 2 | Module-Data-Groups - #1528

Open
abmhts wants to merge 16 commits into
CodeYourFuture:mainfrom
abmhts:module-Data-group/sprint-2
Open

abmhts wants to merge 16 commits into
CodeYourFuture:mainfrom
abmhts:module-Data-group/sprint-2

Conversation

@abmhts

@abmhts abmhts commented Nov 15, 2026

Copy link
Copy Markdown
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1083

Changelist

Debugged, implemented and interpreted the code across multiple files.

@abmhts abmhts added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 15, 2026
@LonMcGregor LonMcGregor added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 16, 2026
Comment thread Sprint-2/implement/tally.js Outdated
const list_of_items= {};

for (const item of items) {
if (list_of_items [item]) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does list_of_items[item] return on the first occurrence of an item such as "toString"?

To "like" or "dislike" this comment, please follow this link

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty object inherits properties from Object.prototype, so checking "toString" returns an inherited function. I've changed the object to Object.create(null) to avoid this issue.

Comment thread Sprint-2/interpret/invert.js Outdated
return invertedObj;
}

console.log(invert);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What output appears whenever a test or another module imports this file?

To "like" or "dislike" this comment, please follow this link

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed console.log(invert);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the correction and updated the currency mapping to GBP.

Comment thread Sprint-2/implement/lookup.test.js Outdated
const countryCurrencyPairs = [
["US", "USD"],
["CA", "CAD"],
["GB", "GPB"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fixture uses GPB for GB, and the expected object repeats that value, so this test accepts the wrong currency code. What code should this mapping use?

To "like" or "dislike" this comment, please follow this link

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 16, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

@abmhts abmhts added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 16, 2026
@tee4tao tee4tao added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 17, 2026
Comment thread Sprint-2/implement/lookup.js Outdated
function createLookup() {
// implementation here
function createLookup(countryCurrencyPairs) {
const c_Lookup = {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things to look at. JavaScript convention for variables is camelCase, so what would this name look like without the underscore? Also, what does the c stand for, and would a reader know without asking?

Comment thread Sprint-2/implement/querystring.js Outdated
Comment on lines +24 to +25
key = decodeURIComponent(key.replace(/\+/g, " "));
value = decodeURIComponent(value.replace(/\+/g, " "));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same two-step transformation (replace then decodeURIComponent) is written twice. Would a small, well-named helper give you one place to change the rule? Also compare replace(/\+/g, " ") with replaceAll("+", " "). Is the regex buying you anything here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a reusable "decodeFormValue()" helper to avoid duplication and replaced the regex with the simpler "replaceAll()" method.

Comment thread Sprint-2/implement/tally.js Outdated
if (!Array.isArray(items)) {
throw new Error("tally requires an array");
}
const list_of_items= Object.create(null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaScript convention for variables is camelCase, so what would this name look like without the underscores?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated variable names to follow camelCase convention, replacing underscores and unclear abbreviations with descriptive names.

Comment thread Sprint-2/implement/tally.js Outdated
throw new Error("tally requires an array");
}
const list_of_items= Object.create(null);
// const list_of_items= {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to always remove dead code before submitting.

Comment thread Sprint-2/implement/tally.test.js Outdated
// When passed to tally
// Then it should throw Error("tally requires an array")

test("throws an error for a string", () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name says “a string”, but the test also covers a number and no argument at all.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the test name to cover all invalid inputs: a string, a number, or no argument.

@tee4tao tee4tao added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Nov 17, 2026
@abmhts abmhts added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants